package com.springboot.framework.controller;

import com.springboot.framework.annotation.ACS;
import com.springboot.framework.controller.request.CategoryInsertBean;
import com.springboot.framework.vo.ResponseVO;
import com.springboot.framework.exception.BusinessException;
import com.springboot.framework.model.CategoryModel;
import com.springboot.framework.service.CategoryService;
import com.springboot.framework.utils.ResponseVoUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @Author SWF
 * @Date 2019/6/6 15:45
 **/
@Api(description = "品类")
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @ACS(allowAnonymous = true)
    @ApiOperation(value = "所有可用品类",notes = "所有可用品类")
    @GetMapping("/list")
    public ResponseVO<List<CategoryModel>> list(){
        List<CategoryModel> categoryModels = categoryService.listNormal();
        return ResponseVoUtil.success(categoryModels);
    }
}
